﻿using SnakeGame.Lesson3;
using System;

namespace SnakeGame.Lesson4
{
    /// <summary>
    /// 蛇身体的类型
    /// </summary>
    enum E_SnakeBodyType
    {
        /// <summary>
        /// 蛇头
        /// </summary>
        Head,
        /// <summary>
        /// 蛇身
        /// </summary>
        Body
    }
    internal class SnakeBody : GameObject
    {
        private readonly E_SnakeBodyType type;

        public SnakeBody(int x, int y, E_SnakeBodyType type)
        {
            position = new Position(x, y);
            this.type = type;
        }

        public override void Draw()
        {
            Console.SetCursorPosition(position.x, position.y);
            Console.ForegroundColor = type == E_SnakeBodyType.Head ? ConsoleColor.Red : ConsoleColor.White;
            Console.Write("■");
        }
    }
}
